﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BlindBox : MonoBehaviour
{
    public CommodityItem m_GetItem;
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }

    public void OnBuyClicked()
    {
        if (Player.Instance.Money < 998)
        {
            MessageShow.Instance.Messaage("你钱不够啦，等攒够钱在送...来买东西吧！");
            return;
        }
        var item = ItemFactory.Instance.createRandomItem();
        m_GetItem.Item = item;
        if(item != null)
        {
            Player.Instance.Money -= 998;
            Player.Instance.addItem(item.m_Type);
            MessageShow.Instance.Messaage("惊喜大盲盒：获得\""+item.Name+"\"一个");
        }
    }
}
